package com.example.zhu.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.zhu.VO.RoomVo.RoomVO;
import com.example.zhu.dto.Order;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RoomMapper  {
    @Select("SELECT * FROM room ORDER BY name")
    List<RoomVO> getAllList( RoomVO roomVO);
    @Select("SELECT floor FROM room  GROUP BY floor ORDER BY floor ")
    List<RoomVO> selectList();
    @Update("UPDATE room SET status= #{i} ,order_id=#{orderId} WHERE name=#{name}")
    void updataStatus(String name, int i,String orderId);
    @Select("SELECT * FROM room WHERE name=#{name} ")
    RoomVO selectName(RoomVO roomVO);
    @Select("SELECT * FROM room ORDER BY floor ")
    List<RoomVO> selectAll();
    @Insert("INSERT INTO room (name, status, floor, room_type_name) VALUES (#{name},0,#{floor},#{roomTypeName})")
    void insert(RoomVO roomVO);
    @Update("UPDATE room SET name=#{name}, floor=#{floor},room_type_name=#{roomTypeName} WHERE id=#{id}")
    void updata(RoomVO roomVO);
    @Delete("DELETE FROM room WHERE id=#{id}")
    void deleteById(String id);
    @Select("SELECT * FROM room WHERE floor like #{floor}  ORDER BY name ")
    List<RoomVO> selectFloorList(String floor);
    @Select("SELECT * FROM room WHERE name  like #{name} ORDER BY name ")
    List<RoomVO> selectNameList(String floor);
    @Select("SELECT * FROM room WHERE order_id like #{orderId}")
    RoomVO selectByOrderId(String orderId);
}